home *** CD-ROM | disk | FTP | other *** search
/ Nautilus 1992 July / Nautilus-3-8 / Nautilus-3-8.bin / Tools & Utilities / Techy Stuff / Doco ƒ / CSMP ƒ / CSMP-V1-098.TXT < prev    next >
Encoding:
Text File  |  1992-06-30  |  31.7 KB  |  771 lines

  1. C.S.M.P. Digest             Thu, 28 May 92       Volume 1 : Issue 98
  2.  
  3. Today's Topics:
  4.  
  5.     cute diskdrive icons
  6.     PwrBk 100 missing 32Bit QD?
  7.     AppleEvents over the network.
  8.     How can I rotate a PICT?
  9.     MPW C++ question (bug?)
  10.  
  11.  
  12. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  13.  
  14. These digests are available (by using FTP, account anonymous, your email
  15. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  16. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  17. Questions list.  The last several issues of the digest are available from
  18. sumex-aim.stanford.edu as well.
  19.  
  20. These digests are also available via email.  Just send a note saying that you
  21. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  22. automatically receive each new digest as it is created.
  23.  
  24. The digest is a collection of articles from the internet newsgroup comp.sys.
  25. mac.programmer.  It is designed for people who read c.s.m.p. semi-regularly
  26. and want an archive of the discussions.  If you don't know what a newsgroup
  27. is, you probably don't have access to it.  Ask your systems administrator(s)
  28. for details.  (This means you can't post questions to the digest.)
  29.  
  30. The articles in these digests are taken directly from comp.sys.mac.programmer.
  31. They are not edited; all articles included in this digest are in their original
  32. posted form.  The only articles that are -not- included in these digests are
  33. those which didn't receive any replies (except those that give information
  34. rather than ask a question).  All replies to each article are concatenated
  35. onto the original article in the order in which they were received.  Article
  36. threads are not added to the digests until the last article added to the
  37. thread is at least one month old (this is to ensure that the thread is dead
  38. before adding it to the digests).
  39.  
  40. Send administrative mail to mkelly@cs.uoregon.edu.
  41.  
  42. -------------------------------------------------------
  43.  
  44. From: ebido@bio.vu.nl (Etienne Bido)
  45. Subject: cute diskdrive icons
  46. Date: 13 Apr 92 23:48:45 GMT
  47. Organization: VU Biology, Amsterdam, The Netherlands
  48.  
  49. I' ve noticed that when using some apps. or DA's there are two icons
  50. for the internal and external drive. I like those icons because they
  51. show which disk is in the internal/external drive. 
  52. Is there a way to have the finder automatically use those icons when
  53. you insert a disk?
  54. I've been looking for them but I can't find those icons in the system
  55. or he finder. Where are they stored?
  56. I know that you can give each disk a different icon but they keep
  57. that icon whether you put the disk in the int. or the ext. drive.
  58.  
  59. thanx!
  60.  
  61. - -- 
  62. Etienne Bido            |ebido@bio.vu.nl    
  63. Vrye Universiteit        |bido@chem.vu.nl
  64. Amsterdam
  65. The Netherlands
  66.  
  67. +++++++++++++++++++++++++++
  68.  
  69. From: Ray.Arachelian@f204.n2603.z1.ieee.org (Ray Arachelian)
  70. Date: 21 Apr 92 16:35:00 GMT
  71. Organization: FidoNet node 1:2603/204 - Not Even Odd, Forest Hills NY
  72.  
  73. On 04-14-92, EBIDO@BIO.VU.NL wrote to ALL:
  74.  
  75.  E> I' ve noticed that when using some apps. or DA's there are two icons 
  76.  E> for the internal and external drive. I like those icons because they 
  77.  E> show which disk is in the internal/external drive. Is there a way to 
  78.  E> have the finder automatically use those icons when you insert a disk? 
  79.  
  80. Nope.  Not unless you want to write your own INIT or CDEV that does this.  
  81.  
  82. As for the icons themselves, using ResEdit to open the System file or 
  83. Finder, as you've said doesn't give them away.  I've a feeling that they 
  84. might be device dependant.  But if you can capture the screen when these 
  85. show up, then you can cut them out of the PICT file and build your own 
  86. icons.  Still you'd need an INIT to display them...
  87.  
  88. As a matter of fact, I've done you the favor of capturing the external 
  89. drive icon.  (I don't have an internal drive because I build my own Mac 
  90. IIcx, "Hackintosh IIcx" if you will, and at the time I couldn't find a 
  91. decently priced Superdrive.   Go into ResEdit, create a new resource of 
  92. ICON type, then close the icon editor, open that resource with the hex 
  93. editor, select all, and paste these hex numbers on top of it:
  94.  
  95. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
  96. 00 00 00 00 00 00 00 00 00 00 10 00 00 00 10 FF FF FC 10 80 00 04 10 FF FF 
  97. FC 7C 80 00 04 38 FF FF FC 10 80 01 F4 00 A0 00 05 FF 80 00 05 01 FF FF FD 
  98. 7D 80 00 05 01 FF FF FD FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
  99. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
  100. 00 00 00
  101.  
  102.  
  103.  * Freddie 1.2b7 * You have been found guilty of commerce with the devil.
  104.  
  105. - --  
  106. =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  107.  Ray Arachelian - Internet: Ray.Arachelian@f204.n2603.z1.ieee.org
  108.  
  109. +++++++++++++++++++++++++++
  110.  
  111. From: Jeremiah.Blatz@dartmouth.edu (Jeremiah Blatz)
  112. Date: 25 Apr 92 20:36:31 GMT
  113. Organization: Dartmouth College, Hanover, NH
  114.  
  115. On 04-14-92, EBIDO@BIO.VU.NL wrote to ALL:
  116.  
  117.  E> I' ve noticed that when using some apps. or DA's there are two
  118. icons 
  119.  E> for the internal and external drive. I like those icons because
  120. they 
  121.  E> show which disk is in the internal/external drive. Is there a way
  122. to 
  123.  E> have the finder automatically use those icons when you insert a
  124. disk?
  125.  
  126. If you're using pre-Sys. 7, you can easily do this. Just open the
  127. Finder w/ResEdit, and open the "LAYO" resc. Scroll down until you see
  128. "use phys. icons," or something like that. Set that bit to true. Save &
  129. Quit, it's as easy as that. I think you need to restart.
  130.  
  131. Hope this helps,
  132. Jeremiah
  133.  
  134. +++++++++++++++++++++++++++
  135.  
  136. From: ebido@bio.vu.nl (Etienne Bido)
  137. Date: 27 Apr 92 11:13:42 GMT
  138. Organization: VU Biology, Amsterdam, The Netherlands
  139.  
  140. E> I' ve noticed that when using some apps. or DA's there are two
  141. icons
  142.  E> for the internal and external drive. I like those icons because
  143. they
  144.  E> show which disk is in the internal/external drive. Is there a way
  145. to
  146.  E> have the finder automatically use those icons when you insert a
  147. disk?
  148.  
  149. If you're using pre-Sys. 7, you can easily do this. Just open the
  150. Finder w/ResEdit, and open the "LAYO" resc. Scroll down until you see
  151. "use phys. icons," or something like that. Set that bit to true. Save &
  152. Quit, it's as easy as that. I think you need to restart.
  153.  
  154. Hope this helps,
  155. Jeremiah           
  156.  
  157. =====================
  158. Thanx to all the people who send me this tip.
  159. But (un)fortunately I'm running sys 7, and the finder doesn't have a LAYO
  160. resc. 
  161. How can you do this in System 7?
  162.  
  163. - -- 
  164. Etienne Bido            |ebido@bio.vu.nl    
  165. Vrye Universiteit        |bido@chem.vu.nl
  166. Amsterdam
  167. The Netherlands
  168.  
  169. ---------------------------
  170.  
  171. From: rrichter@link.ph.gmr.com (Roy Richter)
  172. Subject: PwrBk 100 missing 32Bit QD?
  173. Date: 27 Apr 92 12:36:41 GMT
  174. Organization: GM Research, Warren, Mi
  175.  
  176. Or am I missing something?  I assumed that since the PowerBook 100 was
  177. running System 7.0.1, that it would have the latest version of Quickdraw.
  178. Unfortunately, when I check using the Gestalt call ,the answer I get back
  179. is 0, that it is running the original version.
  180.  
  181. Is it me or the machine?  (and of course, why?)
  182. - --
  183. Roy Richter                  Internet: rrichter@ph.gmr.com
  184. Physics Dept, GM Research    UUCP:     rphroy!rrichter
  185.  
  186. +++++++++++++++++++++++++++
  187.  
  188. From: potts@itl.itd.umich.edu (Paul Potts)
  189. Date: 27 Apr 92 13:27:27 GMT
  190. Organization: Instructional Technology Laboratory, University of Michigan
  191.  
  192. In article <83108@rphroy.ph.gmr.com> rrichter@link.ph.gmr.com (Roy Richter) writes:
  193. >Or am I missing something?  I assumed that since the PowerBook 100 was
  194. >running System 7.0.1, that it would have the latest version of Quickdraw.
  195. >Unfortunately, when I check using the Gestalt call ,the answer I get back
  196. >is 0, that it is running the original version.
  197. >
  198. >Is it me or the machine?  (and of course, why?)
  199.  
  200. It is the machine. Yes, the PB 100 doesn't have color QuickDraw or
  201. 32-bit QuickDraw. Color QuickDraw uses instructions and addressing modes
  202. only available on the 68020 or better processor. It might be possible to
  203. write color QuickDraw to use only 68000 instructions, but it would run so
  204. slowly as to be not worth the effort. So, you can't use GWorlds or PixMaps
  205. on a PB100. On a 68000-based machine, though, you really wouldn't want to -
  206. things would be painfully slow.
  207.  
  208. The PB100 is a black-and-white machine - why do you need color QuickDraw on
  209. it? If you are writing an application that should run on older Macs, like
  210. the SE and Plus, you will need to operate using Classic QuickDraw as well.
  211. If your color needs are minimal, you can use the original 8 QuickDraw colors -
  212. this will appear in color on a color machine, and in black and white on a 
  213. B&W machine.
  214.  
  215. If your app just can't run without color QD, you can always issue a polite
  216. message like "get a real Mac, bub" and exit.
  217.  
  218. - -- 
  219. Paul Potts - potts@itl.itd.umich.edu
  220. Un damne' descendant sans lampe,/ Au bord d'un gouffre dont l'odeur
  221. Trahit l'humide profondeur,/ D'e'ternels escaliers sans rampe... 
  222.    -Baudelaire on DOS/Windows programming   
  223.  
  224. +++++++++++++++++++++++++++
  225.  
  226. From: rdclark@Apple.COM (Richard Clark)
  227. Date: 27 Apr 92 16:07:25 GMT
  228. Organization: Apple Computer Inc., Cupertino, CA
  229.  
  230. Roy --
  231.  
  232.   Like QuickTime, 32-Bit Quickdraw requires a 68020 or later (it requires some
  233. instructions and addressing modes not available on the original 68000.) Since
  234. the Powerbook 100 contains a 68000, 32-Bit Quickdraw will not run on this 
  235. machine.
  236.  
  237. ...Richard
  238.  
  239. - -- 
  240. Richard Clark   Instructor/Course Designer, Developer University    Apple Comp.
  241. - -- 
  242. Richard Clark   Instructor/Course Designer, Developer University    Apple Comp.
  243.  
  244. ---------------------------
  245.  
  246. From: molla@zeus.uucp (Levent Mollamustafaoglu)
  247. Subject: AppleEvents over the network.
  248. Date: 26 Apr 92 21:30:31 GMT
  249. Organization: Aiken Computation Lab, Harvard University
  250.  
  251. I've done a considerable amount of programming with MacApp and Think
  252. Pascal on the Mac, but I have not started with System 7 applications
  253. yet, so I need some help from OOP/AppleEvents gurus.
  254.  
  255. I have a discrete-event simulation program that runs on a parallel
  256. machine, the Maspar MP-1. The algorithm I use is especially suitable
  257. for parallel/distributed simulation since it does not require extensive
  258. communication between processors. One processor which runs the main
  259. engine generates lots of random numbers and transfers those numbers
  260. to other processors which do the dirty simulation work. On a parallel
  261. machine, this is very easy. 
  262.  
  263. I am planning to implement the same idea on an Appletalk network and
  264. considering the possibility of using some network-wide Apple events.
  265. Since the code will be object-oriented and I am planning to write it
  266. with Think Pascal and TCL, the communication should be in the form of
  267. a message that can be conveyed through a network-wide Apple event
  268. (though it can also be done by sending individual messages to each 
  269. remote program) and activates a method of an object in the remote 
  270. program. The message can be followed by a block of data.
  271.  
  272. I wonder whether there is a way to send AppleEvents transparently.
  273. namely, I can send a particular event to a number of applications,
  274. some of which can be local, and some residing on other Macs on the
  275. network.
  276.  
  277. If some of the ideas summarized above trivially coincide with
  278. already existing methods, I would be very glad if you can give some
  279. pointers. (Inside Mac VI is a huge book, and not always that clear)
  280.  
  281.  
  282. ===========================================================================
  283. Dr. Levent Mollamustafaoglu       Harvard University    
  284. molla@paone.harvard.edu    molla@metatron.harvard.edu
  285. ===========================================================================
  286.  
  287. +++++++++++++++++++++++++++
  288.  
  289. From: rdclark@Apple.COM (Richard Clark)
  290. Date: 27 Apr 92 16:00:46 GMT
  291. Organization: Apple Computer Inc., Cupertino, CA
  292.  
  293. molla@zeus.uucp (Levent Mollamustafaoglu) writes:
  294.  
  295. >I am planning to implement the same idea on an Appletalk network and
  296. >considering the possibility of using some network-wide Apple events.
  297.  
  298.   Since the Apple event manager uses AppleTalk as the transport medium, you
  299. cannot "broadcast" an Apple event. Your only option is to send the event 
  300. serially to each receiver.
  301.  
  302. >I wonder whether there is a way to send AppleEvents transparently.
  303. >namely, I can send a particular event to a number of applications,
  304. >some of which can be local, and some residing on other Macs on the
  305. >network.
  306.  
  307.   Yes, you can, using the "TargetID" address format. TargetIDs are valid for
  308. processes on the same machine as the sender or for processes running anywhere
  309. in the network.
  310.  
  311.   Fortunately, the "IPCListPorts" call will help you find the addresses of 
  312. other processes on the network. You specify a NBP-style lookup record , and
  313. IPCListPorts searches the network and returns a list of TargetIDs. 
  314.  
  315.   Hope this helps.
  316.  
  317. ...Richard
  318. - -- 
  319. End user scripting: Hopeful programmers' fantasy that, deep inside, users are
  320.                     just like them.
  321.  
  322. ---------------------------
  323.  
  324. From: petrus@stacken.kth.se (Lars Petrus)
  325. Subject: How can I rotate a PICT?
  326. Date: 14 Apr 92 14:01:27 GMT
  327. Organization: Stacken Computer Club, Stockholm, Sweden
  328.  
  329.  
  330.    I have a PICT that is read from a resource. How can I rotate it
  331. in memory or at least display it rotated? I'm only interested in
  332. 90 degree intervals, so no fancy mathematics is needed.
  333.  
  334.  
  335. "Madness is the first sign of dandruff" |   Email:   petrus@alex.stacken.kth.se
  336.    - Dr Winston O'Boogie                |   Reality: Lars Petrus, Solna, Sweden
  337.  
  338. +++++++++++++++++++++++++++
  339.  
  340. From: aubourg@dmi.ens.fr (Eric Aubourg)
  341. Date: 24 Apr 92 14:02:01 GMT
  342. Organization: Ecole Normale Superieure, PARIS, France
  343.  
  344. In article <1992Apr14.140127.17727@kth.se> petrus@stacken.kth.se (Lars Petrus) writes:
  345. >
  346. >   I have a PICT that is read from a resource. How can I rotate it
  347. >in memory or at least display it rotated? I'm only interested in
  348. >90 degree intervals, so no fancy mathematics is needed.
  349. >
  350. >
  351. >"Madness is the first sign of dandruff" |   Email:   petrus@alex.stacken.kth.se
  352. >   - Dr Winston O'Boogie                |   Reality: Lars Petrus, Solna, Sweden
  353.  
  354. Look on ftp.apple.com. There is a file rotate-bitmap-90-degrees.hqx
  355. I think it's in mac/sc/snippets/graphics.printing/quickdraw
  356.  
  357. Eric
  358.  
  359. ---------------------------
  360.  
  361. From: jtteh@dbase.a-t.com (J.T. Teh)
  362. Subject: MPW C++ question (bug?)
  363. Date: 23 Apr 92 21:15:02 GMT
  364. Organization: Borland International, Inc.
  365.  
  366. What's wrong with this MacApp/C++ code?
  367. GetItem and OpenDeskAcc uses the definitions from MacApp's include
  368. files.
  369.  
  370. Str255 daName;
  371. GetItem(menuID, itemID, daName);
  372. OpenDeskAcc(daName);
  373.  
  374. where menuID and itemID are obtained from the event record. CFront
  375. generates code to copy daName to a temporary CStr255 and passes
  376. the record to GetItem. However it never copies the string passed back
  377. from GetItem to daName. So, OpenDeskAcc never gets the right string
  378. passed back from GetItem.
  379.  
  380. Is the above a bug? Thanks.
  381.  
  382. - -J.T.
  383.  
  384. BTW, declaring daName as a CStr255 works correctly.
  385.  
  386. - ----------------------------------------------------------------------
  387. J.T. Teh          Borland International Inc.     jtteh@genghis.A-T.COM
  388.                                                        MCI Mail: JTTEH
  389.  
  390.                    " WILL  CODE  FOR  FOOD ! "
  391.  
  392. - ----------------------------------------------------------------------
  393.  
  394. +++++++++++++++++++++++++++
  395.  
  396. From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  397. Date: 25 Apr 92 16:18:56 GMT
  398. Organization: University of Illinois at Urbana
  399.  
  400. jtteh@dbase.a-t.com (J.T. Teh) writes:
  401.  
  402. >What's wrong with this MacApp/C++ code?
  403. >GetItem and OpenDeskAcc uses the definitions from MacApp's include
  404. >files.
  405.  
  406. !$@#!%@#!$% There is nothing wrong with CFront, you know that the answer is to
  407. declare it a CStr255, so why are you calling it a bug!? I swear, *everybody*
  408. rather than reading the ARM, just goes and calls something they don't understand
  409. a compiler bug. It drives me up the %@$^%$# wall.
  410.  
  411. Would you expect this to work:
  412. foo(char*);
  413. int* i; foo(i);
  414.  
  415. No, of course not, the pointers are not compatible. So why do you expect passing
  416. a Str255& to a routine that takes a CStr255& to work? A reference is a pointer.
  417. *Because* it's a reference, the compiler can generate temporaries. Yes, it's
  418. stupid that the language doesn't take the temporary and try to assign it back,
  419. but this is described in the ARM. It's also very stupid that MPW CFront doesn't
  420. see fit to warn you about this situation unless you turn on -w1, in which case
  421. it also prints out 2 billion other totally stupid meaningless warnings. It's
  422. also really stupid that the MacApp team can't make up their minds what they want
  423. to call things, and have gone and renamed the String class CStr255 even though
  424. for ages I've typed "Str255" and there *is* a Str255 class but you need to use
  425. a CStr255 everywhere and the compiler doesn't complain if you accidentally use
  426. a Str255 but the code doesn't work. I'm just going to have to work for Apple and
  427. kick and scream until they get a clue and quit doing these stupid totally
  428. arbitrary things and start using the talent that I know is there because it
  429. occasionally accidentally shows up.
  430.  
  431. But I really, really, really wish peaple would read the ARM or C++ v2.0 before
  432. posting things like 'Surprise, a bug in C for ANY compiler' when they are
  433. acting stupid with scanf, or references, or... Reading it -- or Stroustrup's
  434. 2.0 edition, which is quite good -- is a smart idea anyway. I'm totally willing
  435. to explain obscure parts of the language to others, but it gets tiring real fast
  436. when they come to me first rather than looking it up. How do you expect to
  437. learn the language?
  438.  
  439. My rule of thumb: It's never, ever a compiler bug. It's not a MacApp bug. It's
  440. my bug and I'm a total moron for not realizing it immediately. So I make *damn*
  441. sure it's not because I'm a stupid fool who shouldn't be programming, and when
  442. I've read the assembly and ARM several times, *then* I can blame someone else.
  443. - -- 
  444. Mark Lanett, Software Tools Group, NCSA; mlanett@uiuc.edu; NCSA.STG (AppleLink)
  445.  
  446. +++++++++++++++++++++++++++
  447.  
  448. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  449. Organization: Kalamazoo College
  450. Date: Sat, 25 Apr 1992 19:04:11 GMT
  451.  
  452. Mark Lanett writes:
  453. >
  454. >!$@#!%@#!$% There is nothing wrong with CFront, you know that the answer is to
  455. >declare it a CStr255, so why are you calling it a bug!? I swear, *everybody*
  456. >rather than reading the ARM, just goes and calls something they don't
  457. >understand a compiler bug. It drives me up the %@$^%$# wall.
  458. >
  459. [30 lines deleted]
  460. >
  461. >So I make *damn*
  462. >sure it's not because I'm a stupid fool who shouldn't be programming, and when
  463. >I've read the assembly and ARM several times, *then* I can blame someone else.
  464.  
  465. Aren't you being a little hard on J.T.?  S/he was questioning whether
  466. it was a bug, not stating that it was.  Programmers, in this forum
  467. at least, are allowed to try to learn without being implicitly called
  468. "stupid fools."
  469.  
  470. If novice programmers' questions really drive you up the %@$^%$# wall,
  471. maybe you should stop reading c.s.m.p.
  472. - -- 
  473.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  474.  Glass of milk / Standing in between extinction in the cold
  475.  And explosive radiating growth
  476.  
  477. +++++++++++++++++++++++++++
  478.  
  479. From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  480. Organization: University of Illinois at Urbana
  481. Date: Sat, 25 Apr 1992 22:20:17 GMT
  482.  
  483. k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  484.  
  485. >Aren't you being a little hard on J.T.?  S/he was questioning whether
  486. >it was a bug, not stating that it was.  Programmers, in this forum
  487. >at least, are allowed to try to learn without being implicitly called
  488. >"stupid fools."
  489.  
  490. >If novice programmers' questions really drive you up the %@$^%$# wall,
  491. >maybe you should stop reading c.s.m.p.
  492.  
  493. I've nothing against novice questions, just the ones that can be easily answered
  494. by one's local C++ book. UseNet should be a place to go for last resort or 
  495. clarification. And I consider 'last resort' a relative term; in the case of,
  496. say, MABuild internals, I would not wish upon anyone the need to read the source
  497. code. And Apple has made the reference question likely to pop up with their
  498. 3.0b3 changes to MacApp. But it *is* something that is documented.
  499.  
  500. Mark L
  501. - -- 
  502. Mark Lanett, Software Tools Group, NCSA; mlanett@uiuc.edu; NCSA.STG (AppleLink)
  503.  
  504. +++++++++++++++++++++++++++
  505.  
  506. From: pl4262@csc.albany.edu (Peter Lau)
  507. Organization: State University of New York at Albany
  508. Date: 25 Apr 92 19:40:28
  509.  
  510. In article <mlanett.704240417@void> mlanett@void.ncsa.uiuc.edu (Mark Lanett) 
  511. writes:
  512.  
  513. >   I've nothing against novice questions, just the ones that can be easily answered
  514. >   by one's local C++ book. UseNet should be a place to go for last resort or 
  515. >   clarification. And I consider 'last resort' a relative term; in the case of,
  516. >   say, MABuild internals, I would not wish upon anyone the need to read the source
  517. >   code. And Apple has made the reference question likely to pop up with their
  518. >   3.0b3 changes to MacApp. But it *is* something that is documented.
  519.  
  520. Just want to comment on the above statements. I think
  521. the degree of difficulty of a question depends on the
  522. knowledge of the person who ask the question. The question
  523. might be easy to you but might not be easy to someone else.
  524.  
  525. If you don't want to help, hit the 'n' key and forget about
  526. the posting. At least that could keep your blood pressure low
  527. and save the energy to debug your stuffs.  :-)
  528.  
  529. pete
  530.  
  531. +++++++++++++++++++++++++++
  532.  
  533. From: ksand@apple.com (Kent Sandvik)
  534. Date: 27 Apr 92 02:53:27 GMT
  535. Organization: MacDTS Mongols
  536.  
  537. In article <mlanett.704218736@void>, mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  538. writes:
  539. > No, of course not, the pointers are not compatible. So why do you expect
  540. passing
  541. > a Str255& to a routine that takes a CStr255& to work? A reference is a
  542. pointer.
  543. > *Because* it's a reference, the compiler can generate temporaries. Yes, it's
  544. > stupid that the language doesn't take the temporary and try to assign it back,
  545. > but this is described in the ARM. It's also very stupid that MPW CFront
  546. doesn't
  547. > see fit to warn you about this situation unless you turn on -w1, in which case
  548. > it also prints out 2 billion other totally stupid meaningless warnings. It's
  549. > also really stupid that the MacApp team can't make up their minds what they
  550. want
  551. > to call things, and have gone and renamed the String class CStr255 even though
  552. > for ages I've typed "Str255" and there *is* a Str255 class but you need to use
  553. > a CStr255 everywhere and the compiler doesn't complain if you accidentally use
  554. > a Str255 but the code doesn't work. I'm just going to have to work for Apple
  555. and
  556. > kick and scream until they get a clue and quit doing these stupid totally
  557. > arbitrary things and start using the talent that I know is there because it
  558. > occasionally accidentally shows up.
  559.  
  560. Well, I tried to make them call all these new stack-based functions with
  561. a starting T, like in TStr255 :-). They really wanted to point out that certain
  562. classes are stack-based, so they used prefix C for that. And they didn't want
  563. to confuse programmers more with having the same name for a struct and a
  564. utility class - which DTS also considered to be a wise thing.
  565.  
  566. Note that all these MacApp utility classes are not officially sanctioned
  567. as the C++ interface definition, this is only something that MacApp has,
  568. and it's not sure it will be a C++ convention at all. I hope not, because
  569. I don't want to maintain more than one-two header file sets. Otherwise we
  570. could introduce more bugs.
  571.  
  572. > But I really, really, really wish peaple would read the ARM or C++ v2.0 before
  573. > posting things like 'Surprise, a bug in C for ANY compiler' when they are
  574. > acting stupid with scanf, or references, or... Reading it -- or Stroustrup's
  575. > 2.0 edition, which is quite good -- is a smart idea anyway. I'm totally
  576. willing
  577. > to explain obscure parts of the language to others, but it gets tiring real
  578. fast
  579. > when they come to me first rather than looking it up. How do you expect to
  580. > learn the language?
  581.  
  582. You must understand that there are many newcomers to C++ that don't know about
  583. all the tricks of the trade. Be patient, they will learn! Otherwise I agree
  584. that there's a lot of good literature out there, the buzzword C++ has created
  585. a lot of books. ARM should be one of the standard reference books in every
  586. bookshelf,
  587. I would estimate that I have answered about 200-300 DTS C++ questions just by
  588. looking up the answer in ARM, hehe...
  589.  
  590.  
  591. Cheers,
  592. Kent
  593.  
  594. +++++++++++++++++++++++++++
  595.  
  596. From: neeri@iis.ethz.ch (Matthias Ulrich Neeracher)
  597. Date: 27 Apr 92 12:12:10 GMT
  598. Organization: Integrated Systems Laboratory, ETH, Zurich
  599.  
  600. In article <mlanett.704218736@void> mlanett@void.ncsa.uiuc.edu (Mark Lanett) writes:
  601. >jtteh@dbase.a-t.com (J.T. Teh) writes:
  602. >
  603. >>What's wrong with this MacApp/C++ code?
  604. >>GetItem and OpenDeskAcc uses the definitions from MacApp's include
  605. >>files.
  606. >
  607. >!$@#!%@#!$% There is nothing wrong with CFront, you know that the answer is to
  608. >declare it a CStr255, so why are you calling it a bug!? I swear, *everybody*
  609. >rather than reading the ARM, just goes and calls something they don't understand
  610. >a compiler bug. It drives me up the %@$^%$# wall.
  611.  
  612. While I generally agree with these feelings...
  613.  
  614. >So why do you expect passing
  615. >a Str255& to a routine that takes a CStr255& to work? A reference is a pointer.
  616. >*Because* it's a reference, the compiler can generate temporaries. Yes, it's
  617. >stupid that the language doesn't take the temporary and try to assign it back,
  618. >but this is described in the ARM.
  619.  
  620. ... I wonder whether whether *you* have read the ARM passage relevant to this
  621. question. To quote from the ARM, section 8.4.3, pages 154--155 in my edition:
  622.  
  623. ******* Begin ARM quote, emphasis is mine ***********************************
  624.  
  625. If the initializer for a reference to type T is an lvalue of type T or of a
  626. type derived (@10) from T for which T is an accessible base (@4.6), the reference
  627. will refer to the initializer; otherwise, IF AND ONLY IF THE REFERENCE IS TO A
  628. CONST an object of type T will be created and initialized with the initializer.
  629. The reference then becomes a name for that object. For example,
  630.  
  631.    double d = 1.0;
  632.  
  633.    double & rd = d;                          // rd refers to `d'
  634.    const double & rcd = d;                   // rcd refers to `d'
  635.  
  636.    double & rd2 = 1;                         // error: type mismatch
  637.    const double & rcd2 = 1;                  // rcd2 refers to temporary
  638.                                              // with value `1'
  639.  
  640. [Comment section]
  641. The distinction between references to consts and references to non-consts is a
  642. major change from earlier definitions of C++. The distinction was made to
  643. eliminate a major source of errors and surprises. Earlier, all references could
  644. be initialized to refer to temporary objects ao all the initializations above
  645. were legal.
  646. Naturally, this feature will be faded out of implementations slowly, to avoid
  647. breaking working code.
  648.  
  649. ******** End ARM quote *****************************************************
  650.  
  651. So, according to the ARM, what J.T. was trying to do is supposed *not to work
  652. at all*, not to silently fail. The behavior of the CFront version that Apple
  653. currently uses is to be considered at least an anachronism and could even be
  654. called a bug.
  655.  
  656. >My rule of thumb: It's never, ever a compiler bug. It's not a MacApp bug. It's
  657. >my bug and I'm a total moron for not realizing it immediately. So I make *damn*
  658. >sure it's not because I'm a stupid fool who shouldn't be programming, and when
  659. >I've read the assembly and ARM several times, *then* I can blame someone else.
  660.  
  661. Agreed. And while we're at it, never claim it's a virus either before having
  662. taken the above steps. Still, there *are* sometimes compiler bugs, there *are*
  663. compiler anachronisms, and there *are* computer virii.
  664.  
  665. Matthias
  666.  
  667. - -----
  668. Matthias Neeracher                                   neeri@iis.ethz.ch
  669.    "Have you heard of the new Cambridge compilers ? They distribute
  670.     gear-wear much more evenly"
  671.         -- William Gibson/Bruce Sterling, _The Difference Engine_
  672.  
  673. +++++++++++++++++++++++++++
  674.  
  675. From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  676. Date: 27 Apr 92 14:32:32 GMT
  677. Organization: University of Illinois at Urbana
  678.  
  679. ksand@apple.com (Kent Sandvik) writes:
  680.  
  681. >In article <mlanett.704218736@void>, mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  682. >writes:
  683. >> also really stupid that the MacApp team can't make up their minds what they
  684. >want
  685. >> to call things, and have gone and renamed the String class CStr255 even though
  686. >> for ages I've typed "Str255" and there *is* a Str255 class but you need to use
  687. >> a CStr255 everywhere and the compiler doesn't complain if you accidentally use
  688. >> a Str255 but the code doesn't work. I'm just going to have to work for Apple
  689. >and
  690. >> kick and scream until they get a clue and quit doing these stupid totally
  691. >> arbitrary things and start using the talent that I know is there because it
  692. >> occasionally accidentally shows up.
  693.  
  694. >Well, I tried to make them call all these new stack-based functions with
  695. >a starting T, like in TStr255 :-). They really wanted to point out that certain
  696.  
  697. That wouldn't be too confusing :-) In one program I used T for classes
  698. *written* in Pascal and C for C++ ones (but PascalObject-descended), which
  699. is yet another way to confuse other people reading your code. Now I've given
  700. up and use no conventions at all. Since everyone has different conventions I
  701. figure this will maximize the discomfort in reading my code. I've also been
  702. known to switch conventions, sometimes in the same class.
  703.  
  704. >classes are stack-based, so they used prefix C for that. And they didn't want
  705. >to confuse programmers more with having the same name for a struct and a
  706. >utility class - which DTS also considered to be a wise thing.
  707.  
  708. I'd argue that 1) you *want* Str255 turned into a class (what good is
  709. a char array?) and 2) It should keep the Str255 name because that's what the
  710. "string" structure has always been called. It's much less confusing if the
  711. data structure for strings is just called Str255, whatever the features. It's
  712. called the same thing in Pascal and C, even though it acts quite different; I
  713. would think Str255 would make more sense, with the C++ version actually
  714. being closer to the Pascal one.
  715. - -- 
  716. Mark Lanett, NCSA Software Development                         mlanett@uiuc.edu
  717.  
  718. +++++++++++++++++++++++++++
  719.  
  720. From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  721. Date: 27 Apr 92 17:20:03 GMT
  722. Organization: University of Illinois at Urbana
  723.  
  724. neeri@iis.ethz.ch (Matthias Ulrich Neeracher) writes:
  725.  
  726. >******* Begin ARM quote, emphasis is mine ***********************************
  727.  
  728. >If the initializer for a reference to type T is an lvalue of type T or of a
  729. >type derived (@10) from T for which T is an accessible base (@4.6), the reference
  730. >will refer to the initializer; otherwise, IF AND ONLY IF THE REFERENCE IS TO A
  731. >CONST an object of type T will be created and initialized with the initializer.
  732. >The reference then becomes a name for that object. For example,
  733.  
  734. >   double d = 1.0;
  735.  
  736. >   double & rd = d;                          // rd refers to `d'
  737. >   const double & rcd = d;                   // rcd refers to `d'
  738.  
  739. >   double & rd2 = 1;                         // error: type mismatch
  740. >   const double & rcd2 = 1;                  // rcd2 refers to temporary
  741. >                                             // with value `1'
  742.  
  743. >[Comment section]
  744. >The distinction between references to consts and references to non-consts is a
  745. >major change from earlier definitions of C++. The distinction was made to
  746. >eliminate a major source of errors and surprises. Earlier, all references could
  747. >be initialized to refer to temporary objects ao all the initializations above
  748. >were legal.
  749. >Naturally, this feature will be faded out of implementations slowly, to avoid
  750. >breaking working code.
  751.  
  752. >******** End ARM quote *****************************************************
  753.  
  754. >So, according to the ARM, what J.T. was trying to do is supposed *not to work
  755. >at all*, not to silently fail. The behavior of the CFront version that Apple
  756. >currently uses is to be considered at least an anachronism and could even be
  757. >called a bug.
  758.  
  759. AT&T C++ 3.0 accepts these constructs but generates a warning. Under +p (pure)
  760. it *is* considered an error.
  761. g++ 2.1 accepts it and doesn't print any warnings, even with -Wall.
  762. I believe CFront will generate an error for this situation under full warnings.
  763. It doesn't complain at all by default, though.
  764. - -- 
  765. Mark Lanett, NCSA Software Development                         mlanett@uiuc.edu
  766.  
  767. ---------------------------
  768.  
  769. End of C.S.M.P. Digest
  770. **********************
  771.